home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / x / volume9 / sco.patches / part08 < prev    next >
Encoding:
Internet Message Format  |  1990-10-12  |  44.8 KB

  1. Path: uunet!cs.utexas.edu!sun-barr!newstop!sun!uunet.uu.net!microsoft!jimke
  2. From: microsoft!jimke@uunet.uu.net
  3. Newsgroups: comp.sources.x
  4. Subject: v09i094: patches for X11R4 for SCO UNIX, Part08/12
  5. Message-ID: <143668@sun.Eng.Sun.COM>
  6. Date: 12 Oct 90 05:20:32 GMT
  7. References: <csx-09i087:sco.patches@uunet.UU.NET>
  8. Sender: news@sun.Eng.Sun.COM
  9. Lines: 1316
  10. Approved: argv@sun.com
  11.  
  12. Submitted-by: microsoft!jimke@uunet.uu.net
  13. Posting-number: Volume 9, Issue 94
  14. Archive-name: sco.patches/part08
  15.  
  16. #! /bin/sh
  17. # This is a shell archive.  Remove anything before this line, then unpack
  18. # it by saving it into a file and typing "sh file".  To overwrite existing
  19. # files, type "sh file -c".  You can also feed this as standard input via
  20. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  21. # will see the following message at the end:
  22. #        "End of archive 8 (of 12)."
  23. # Contents:  fix-14.sco08
  24. # Wrapped by jimke@kellman on Sat Oct  6 17:13:31 1990
  25. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  26. if test -f 'fix-14.sco08' -a "${1}" != "-c" ; then 
  27.   echo shar: Will not clobber existing file \"'fix-14.sco08'\"
  28. else
  29. echo shar: Extracting \"'fix-14.sco08'\" \(42622 characters\)
  30. sed "s/^X//" >'fix-14.sco08' <<'END_OF_FILE'
  31. X*** ./mit-orig/server/ddx/ibm/sysV/OScursor.h    Thu Oct  4 18:02:19 1990
  32. X--- ./mit/server/ddx/ibm/sysV/OScursor.h    Mon Sep 17 10:45:31 1990
  33. X***************
  34. X*** 0 ****
  35. X--- 1,55 ----
  36. X+ /*
  37. X+  * Copyright IBM Corporation 1987,1988,1989
  38. X+  *
  39. X+  * All Rights Reserved
  40. X+  *
  41. X+  * Permission to use, copy, modify, and distribute this software and its
  42. X+  * documentation for any purpose and without fee is hereby granted,
  43. X+  * provided that the above copyright notice appear in all copies and that
  44. X+  * both that copyright notice and this permission notice appear in
  45. X+  * supporting documentation, and that the name of IBM not be
  46. X+  * used in advertising or publicity pertaining to distribution of the
  47. X+  * software without specific, written prior permission.
  48. X+  *
  49. X+  * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  50. X+  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  51. X+  * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  52. X+  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  53. X+  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  54. X+  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  55. X+  * SOFTWARE.
  56. X+  *
  57. X+ */
  58. X+ #ifndef OS_CURS
  59. X+ #define OS_CURS 1
  60. X+ /***********************************************************
  61. X+                 Copyright IBM Corporation 1988
  62. X+                       All Rights Reserved
  63. X+ Permission to use, copy, modify, and distribute this software and its
  64. X+ documentation for any purpose and without fee is hereby granted,
  65. X+ provided that the above copyright notice appear in all copies and that
  66. X+ both that copyright notice and this permission notice appear in
  67. X+ supporting documentation, and that the name of IBM not be
  68. X+ used in advertising or publicity pertaining to distribution of the
  69. X+ software without specific, written prior permission.
  70. X+ IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  71. X+ ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  72. X+ IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  73. X+ ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  74. X+ WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  75. X+ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  76. X+ SOFTWARE.
  77. X+ ******************************************************************/
  78. X+ /* $Header $ */
  79. X+ /* $Source $ */
  80. X+ #define    OS_TellCursorPosition(x,y) \
  81. X+     { SYSVCurrentX = (x) ; SYSVCurrentY = (y) ; }
  82. X+ extern    int    SYSVSetCursorPosition() ;
  83. X+ extern    void    SYSVPointerNonInterestBox() ;
  84. X+ extern    void    SYSVConstrainCursor() ;
  85. X+ extern  void       SYSVCursorLimits() ;
  86. X+ #define    OS_SetCursorPosition        SYSVSetCursorPosition
  87. X+ #define    OS_PointerNonInterestBox    SYSVPointerNonInterestBox
  88. X+ #define OS_ConstrainCursor        SYSVConstrainCursor
  89. X+ #define    OS_CursorLimits            SYSVCursorLimits
  90. X+ #endif /* ndef OS_CURSOR */
  91. X*** ./mit-orig/server/ddx/ibm/sysV/OSio.h    Thu Oct  4 18:02:19 1990
  92. X--- ./mit/server/ddx/ibm/sysV/OSio.h    Mon Sep 17 10:45:31 1990
  93. X***************
  94. X*** 0 ****
  95. X--- 1,93 ----
  96. X+ /*
  97. X+  * Copyright IBM Corporation 1987,1988,1989
  98. X+  *
  99. X+  * All Rights Reserved
  100. X+  *
  101. X+  * Permission to use, copy, modify, and distribute this software and its
  102. X+  * documentation for any purpose and without fee is hereby granted,
  103. X+  * provided that the above copyright notice appear in all copies and that
  104. X+  * both that copyright notice and this permission notice appear in
  105. X+  * supporting documentation, and that the name of IBM not be
  106. X+  * used in advertising or publicity pertaining to distribution of the
  107. X+  * software without specific, written prior permission.
  108. X+  *
  109. X+  * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  110. X+  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  111. X+  * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  112. X+  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  113. X+  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  114. X+  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  115. X+  * SOFTWARE.
  116. X+  *
  117. X+ */
  118. X+ #ifndef OS_IOH
  119. X+ #define OS_IOH 1
  120. X+ /***********************************************************
  121. X+                 Copyright IBM Corporation 1988
  122. X+                       All Rights Reserved
  123. X+ Permission to use, copy, modify, and distribute this software and its
  124. X+ documentation for any purpose and without fee is hereby granted,
  125. X+ provided that the above copyright notice appear in all copies and that
  126. X+ both that copyright notice and this permission notice appear in
  127. X+ supporting documentation, and that the name of IBM not be
  128. X+ used in advertising or publicity pertaining to distribution of the
  129. X+ software without specific, written prior permission.
  130. X+ IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  131. X+ ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  132. X+ IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  133. X+ ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  134. X+ WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  135. X+ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  136. X+ SOFTWARE.
  137. X+ ******************************************************************/
  138. X+ /* $Header $ */
  139. X+ /* $Source $ */
  140. X+ #define    CURRENT_X()    (SYSVCurrentX)
  141. X+ #define    CURRENT_Y()    (SYSVCurrentY)
  142. X+ #define KBD_LSHIFT  0x0001
  143. X+ #define KBD_RSHIFT  0x0002
  144. X+ #define KBD_LALT    0x0004
  145. X+ #define KBD_RALT    0x0008
  146. X+ #define KBD_CTRL    0x0010
  147. X+ #define KBD_MAKE    0x0100
  148. X+ #define KBD_RPT     0x0200
  149. X+ #define MSM_LBUTTON  4
  150. X+ #define MSM_MBUTTON  2
  151. X+ #define MSM_RBUTTON  1
  152. X+ #define MS_LBUTTON   32
  153. X+ #define MS_RBUTTON   16
  154. X+ #define MS_BUTTONS   48
  155. X+ #define MicroSoft    1
  156. X+ #define MouseSystems 0
  157. X+ extern    int    SYSVDefaultDisplay ;
  158. X+ extern    int    SYSVCurrentX ;
  159. X+ extern    int    SYSVCurrentY ;
  160. X+ extern    int    SYSVProcessArgument() ;
  161. X+ extern  char *  SYSVresolution;
  162. X+ extern  char *  SYSVPtrDev;
  163. X+ extern  int     SYSVMouseType;
  164. X+ extern  int     MSMPtrEvent();
  165. X+ extern  int     MSPtrEvent();
  166. X+ extern  int     (* SYSVPtrEvents)();
  167. X+ extern  int     SYSVMouseState;
  168. X+ extern  int     SYSVmouseFd;
  169. X+ extern  int     SYSVconsoleFd;
  170. X+ extern  int     SYSVconsoleNum;
  171. X+ extern    void    NoopDDA() ;
  172. X+ #define    OS_BlockHandler            NoopDDA
  173. X+ #define    OS_WakeupHandler        NoopDDA
  174. X+ #define    OS_MouseProc            SYSVMouseProc
  175. X+ #define    OS_KeybdProc            SYSVKeybdProc
  176. X+ #define    OS_ProcessArgument        SYSVProcessArgument
  177. X+ #define OS_CapsLockFeedback(dir)    NoopDDA()
  178. X+ #define    OS_PreScreenInit()        SYSVMachineDependentInit()
  179. X+ #define    OS_PostScreenInit()        NoopDDA()
  180. X+ #define    OS_ScreenStateChange(e)        NoopDDA()
  181. X+ #define    OS_GetDefaultScreens()        SYSVGetDefaultScreens()
  182. X+ #define    OS_InitInput()            NoopDDA()
  183. X+ #define OS_AddAndRegisterOtherDevices()    NoopDDA()
  184. X+ #define    OS_SaveState()            NoopDDA()
  185. X+ #define    OS_RestoreState()        NoopDDA()
  186. X+ #define    OS_GiveUp()            NoopDDA()
  187. X+ #define    OS_Abort()            NoopDDA()
  188. X+ #endif /* ndef OS_IOH */
  189. X*** ./mit-orig/server/ddx/ibm/sysV/Xibm.man    Thu Oct  4 18:02:19 1990
  190. X--- ./mit/server/ddx/ibm/sysV/Xibm.man    Mon Sep 17 10:45:30 1990
  191. X***************
  192. X*** 0 ****
  193. X--- 1,28 ----
  194. X+ .TH XIBM 1 "Release 4" "X Version 11"
  195. X+ .SH NAME
  196. X+ Xibm - VGA server for the X Window System
  197. X+ .SH DESCRIPTION
  198. X+ .PP
  199. X+ This driver supports the VGA display on a SYS V/386 3.2.
  200. X+ .PP
  201. X+ The VGA hardware is a color display. It supports 16 colors. You can currently
  202. X+ choose from following resolutions:
  203. X+ \fB 640x480 \fP
  204. X+ \fB 720x540 \fP
  205. X+ \fB 864x606 \fP
  206. X+ .SH OPTIONS
  207. X+ \fB-help\fP get some help for server specific options.
  208. X+ .sp
  209. X+ The server also takes all of the standard server options (See \fIXserver(1)\fP
  210. X+ for a complete list.)
  211. X+ .SH "SEE ALSO"
  212. X+ .PP
  213. X+ Xserver(1), xinit(1), X(1)
  214. X+ .SH COPYRIGHT
  215. X+ Copyright 1990, Thomas Roell (PizzaMan).
  216. X+ .br
  217. X+ See \fIX(1)\fP for a full statement of rights and permissions.
  218. X+ .SH AUTHORS
  219. X+ .PP
  220. X+ Thomas Roell (PizzaMan) wrote all SYS V/386 specific pieces.
  221. X+ Original code was done by IBM.
  222. X*** ./mit-orig/server/ddx/ibm/sysV/sysV386.s    Thu Oct  4 18:02:19 1990
  223. X--- ./mit/server/ddx/ibm/sysV/sysV386.s    Mon Sep 17 10:45:33 1990
  224. X***************
  225. X*** 0 ****
  226. X--- 1,41 ----
  227. X+     .text
  228. X+     .align    4
  229. X+     .globl    inb
  230. X+ inb:
  231. X+     pushl    %ebp
  232. X+     movl    %esp,%ebp
  233. X+     movl    8(%ebp),%edx
  234. X+     subl    %eax,%eax
  235. X+     inb    (%dx)
  236. X+     leave
  237. X+     ret
  238. X+     .align    4
  239. X+     .globl    outb
  240. X+ outb:
  241. X+     pushl    %ebp
  242. X+     movl    %esp,%ebp
  243. X+     movl    8(%ebp),%edx
  244. X+     movl    12(%ebp),%eax
  245. X+     outb    (%dx)
  246. X+     leave
  247. X+     ret
  248. X+     .align    4
  249. X+     .globl    inw
  250. X+ inw:
  251. X+     pushl    %ebp
  252. X+     movl    %esp,%ebp
  253. X+     movl    8(%ebp),%edx
  254. X+     subl    %eax,%eax
  255. X+     inw    (%dx)
  256. X+     leave
  257. X+     ret
  258. X+     .align    4
  259. X+     .globl    outw
  260. X+ outw:
  261. X+     pushl    %ebp
  262. X+     movl    %esp,%ebp
  263. X+     movl    8(%ebp),%edx
  264. X+     movl    12(%ebp),%eax
  265. X+     outw    (%dx)
  266. X+     leave
  267. X+     ret
  268. X*** ./mit-orig/server/ddx/ibm/sysV/sysVCursor.c    Thu Oct  4 18:02:20 1990
  269. X--- ./mit/server/ddx/ibm/sysV/sysVCursor.c    Mon Sep 17 16:57:31 1990
  270. X***************
  271. X*** 0 ****
  272. X--- 1,108 ----
  273. X+ /*
  274. X+  * Copyright IBM Corporation 1987,1988,1989
  275. X+  *
  276. X+  * All Rights Reserved
  277. X+  *
  278. X+  * Permission to use, copy, modify, and distribute this software and its
  279. X+  * documentation for any purpose and without fee is hereby granted,
  280. X+  * provided that the above copyright notice appear in all copies and that
  281. X+  * both that copyright notice and this permission notice appear in
  282. X+  * supporting documentation, and that the name of IBM not be
  283. X+  * used in advertising or publicity pertaining to distribution of the
  284. X+  * software without specific, written prior permission.
  285. X+  *
  286. X+  * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  287. X+  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  288. X+  * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  289. X+  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  290. X+  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  291. X+  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  292. X+  * SOFTWARE.
  293. X+  *
  294. X+ */
  295. X+ /***********************************************************
  296. X+         Copyright IBM Corporation 1987
  297. X+                       All Rights Reserved
  298. X+ Permission to use, copy, modify, and distribute this software and its
  299. X+ documentation for any purpose and without fee is hereby granted,
  300. X+ provided that the above copyright notice appear in all copies and that
  301. X+ both that copyright notice and this permission notice appear in
  302. X+ supporting documentation, and that the name of IBM not be
  303. X+ used in advertising or publicity pertaining to distribution of the
  304. X+ software without specific, written prior permission.
  305. X+ IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  306. X+ ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  307. X+ IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  308. X+ ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  309. X+ WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  310. X+ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  311. X+ SOFTWARE.
  312. X+ ******************************************************************/
  313. X+ #include <stdio.h>
  314. X+ #include <sys/types.h>
  315. X+ #include <sys/file.h>
  316. X+ #define NEED_EVENTS
  317. X+ #include "X.h"
  318. X+ #include "Xproto.h"
  319. X+ #include "input.h"
  320. X+ #include "scrnintstr.h"
  321. X+ #include "cursorstr.h"
  322. X+ #include "miscstruct.h"
  323. X+ #include "OSio.h"
  324. X+ #include "ibmScreen.h"
  325. X+ #include "ibmIO.h"
  326. X+ #include "sysVCursor.h"
  327. X+ #include "ibmTrace.h"
  328. X+ /***============================================================***/
  329. X+ void
  330. X+ SYSVConstrainCursor( pScr, pBox )
  331. X+ register ScreenPtr      pScr ;
  332. X+ register BoxPtr         pBox ;
  333. X+ {
  334. X+     TRACE( ( "SYSVConstrainCursor(pScr=0x%x,pBox=0x%x)\n" ) ) ;
  335. X+     /* XXX -- not implemented yet */
  336. X+     return ;
  337. X+ }
  338. X+ /***============================================================***/
  339. X+ int
  340. X+ SYSVSetCursorPosition( pScr, x, y, generateEvent )
  341. X+     register ScreenPtr     pScr;
  342. X+     register int    x,y;
  343. X+     Bool    generateEvent;
  344. X+ {
  345. X+ xEvent        motion;
  346. X+ DevicePtr    mouse;
  347. X+     TRACE(("SYSVSetCursorPosition( pScr= 0x%x, x= %d, y= %d )\n",pScr,x,y));
  348. X+     if (pScr->myNum!=ibmCurrentScreen) {
  349. X+     (*ibmHideCursor(ibmCurrentScreen))(ibmScreen(ibmCurrentScreen));
  350. X+     ibmCurrentScreen= pScr->myNum;
  351. X+     }
  352. X+     if (generateEvent) {
  353. X+     ProcessInputEvents();
  354. X+     motion.u.keyButtonPointer.rootX=    x;
  355. X+     motion.u.keyButtonPointer.rootY=    y;
  356. X+     motion.u.keyButtonPointer.time=    lastEventTime;
  357. X+     motion.u.u.type=            MotionNotify;
  358. X+     mouse= LookupPointerDevice();
  359. X+     (*mouse->processInputProc)(&motion,mouse);
  360. X+     }
  361. X+     SYSVCurrentX= x;
  362. X+     SYSVCurrentY= y;
  363. X+     (*(ibmCursorShow(pScr->myNum)))(x,y);
  364. X+     return TRUE;
  365. X+ }
  366. X+ /***============================================================***/
  367. X+ void
  368. X+ SYSVCursorLimits( pScr, pCurs, pHotBox, pTopLeftBox )
  369. X+ ScreenPtr    pScr;
  370. X+ CursorPtr    pCurs;
  371. X+ BoxPtr        pHotBox;
  372. X+ BoxPtr        pTopLeftBox;
  373. X+ {
  374. X+     TRACE(("SYSVCursorLimits( pScr= 0x%x, pCurs= 0x%x, pHotBox= 0x%x, pTopLeftBox= 0x%x)\n", pScr, pCurs, pHotBox, pTopLeftBox));
  375. X+     pTopLeftBox->x1= max( pHotBox->x1, 0 );
  376. X+     pTopLeftBox->y1= max( pHotBox->y1, 0 );
  377. X+     pTopLeftBox->x2= min( pHotBox->x2, pScr->width );
  378. X+     pTopLeftBox->y2= min( pHotBox->y2, pScr->height );
  379. X+     return ;
  380. X+ }
  381. X*** ./mit-orig/server/ddx/ibm/sysV/sysVCursor.h    Thu Oct  4 18:02:20 1990
  382. X--- ./mit/server/ddx/ibm/sysV/sysVCursor.h    Mon Sep 17 10:45:31 1990
  383. X***************
  384. X*** 0 ****
  385. X--- 1,45 ----
  386. X+ /*
  387. X+  * Copyright IBM Corporation 1987,1988,1989
  388. X+  *
  389. X+  * All Rights Reserved
  390. X+  *
  391. X+  * Permission to use, copy, modify, and distribute this software and its
  392. X+  * documentation for any purpose and without fee is hereby granted,
  393. X+  * provided that the above copyright notice appear in all copies and that
  394. X+  * both that copyright notice and this permission notice appear in
  395. X+  * supporting documentation, and that the name of IBM not be
  396. X+  * used in advertising or publicity pertaining to distribution of the
  397. X+  * software without specific, written prior permission.
  398. X+  *
  399. X+  * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  400. X+  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  401. X+  * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  402. X+  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  403. X+  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  404. X+  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  405. X+  * SOFTWARE.
  406. X+  *
  407. X+ */
  408. X+ #ifndef SYSV_CURS
  409. X+ #define SYSV_CURS 1
  410. X+ /***********************************************************
  411. X+         Copyright IBM Corporation 1987
  412. X+                       All Rights Reserved
  413. X+ Permission to use, copy, modify, and distribute this software and its
  414. X+ documentation for any purpose and without fee is hereby granted,
  415. X+ provided that the above copyright notice appear in all copies and that
  416. X+ both that copyright notice and this permission notice appear in
  417. X+ supporting documentation, and that the name of IBM not be
  418. X+ used in advertising or publicity pertaining to distribution of the
  419. X+ software without specific, written prior permission.
  420. X+ IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  421. X+ ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  422. X+ IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  423. X+ ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  424. X+ WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  425. X+ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  426. X+ SOFTWARE.
  427. X+ ******************************************************************/
  428. X+ extern    int    SYSVSetCursorPosition();
  429. X+ extern    void    SYSVCursorLimits();
  430. X+ #endif /* SYSV_CURS */
  431. X*** ./mit-orig/server/ddx/ibm/sysV/sysVEvents.c    Thu Oct  4 18:02:20 1990
  432. X--- ./mit/server/ddx/ibm/sysV/sysVEvents.c    Mon Sep 17 16:57:32 1990
  433. X***************
  434. X*** 0 ****
  435. X--- 1,555 ----
  436. X+ /*
  437. X+  * Copyright IBM Corporation 1987,1988,1989
  438. X+  *
  439. X+  * All Rights Reserved
  440. X+  *
  441. X+  * Permission to use, copy, modify, and distribute this software and its
  442. X+  * documentation for any purpose and without fee is hereby granted,
  443. X+  * provided that the above copyright notice appear in all copies and that
  444. X+  * both that copyright notice and this permission notice appear in
  445. X+  * supporting documentation, and that the name of IBM not be
  446. X+  * used in advertising or publicity pertaining to distribution of the
  447. X+  * software without specific, written prior permission.
  448. X+  *
  449. X+  * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  450. X+  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  451. X+  * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  452. X+  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  453. X+  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  454. X+  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  455. X+  * SOFTWARE.
  456. X+  *
  457. X+ */
  458. X+ #include <sys/types.h>
  459. X+ #include <sys/times.h>
  460. X+ #define NEED_EVENTS
  461. X+ #define NEED_REPLIES
  462. X+ #include "X.h"
  463. X+ #include "Xproto.h"
  464. X+ #include "miscstruct.h"
  465. X+ #include "scrnintstr.h"
  466. X+ #include "cursorstr.h"
  467. X+ #include "input.h"
  468. X+ #include "inputstr.h"
  469. X+ #include "OScompiler.h"
  470. X+ #include "OSio.h"
  471. X+ #include "OScursor.h"
  472. X+ #include "ibmIO.h"
  473. X+ #include "ibmMouse.h"
  474. X+ #include "ibmKeybd.h"
  475. X+ #include "ibmScreen.h"
  476. X+ #include "ibmCmdArgs.h"
  477. X+ #include "sysVModKeys.h"
  478. X+ #include "ibmTrace.h"
  479. X+ extern  int      screenIsSaved;
  480. X+ extern  int     kbdType ;
  481. X+ static  int      delayed_left;
  482. X+ static  int      delayed_right;
  483. X+ static  int      delayed_middle;
  484. X+ static  int      lastButtons = 0x00 ;
  485. X+ static  int      pendingX;
  486. X+ static  int      pendingY;
  487. X+ static  int      SYSVreset = 0;
  488. X+ static long clock = 0;
  489. X+ int SYSVmouseFd = -1;
  490. X+ int SYSVconsoleFd = -1;
  491. X+ #ifdef sco
  492. X+ int SYSVconsoleNum = -1;
  493. X+ #endif
  494. X+ int SYSVMouseState = 0;
  495. X+ #define GET_OS_TIME() (GetTimeInMillis())
  496. X+ /***====================================================================***/
  497. X+     /*
  498. X+      * 11/19/88 (ef) -- XXX!! Not really sure where these should live.
  499. X+      *    sysvCursor, maybe?
  500. X+      *    Actually, once all of our systems give relative coordinates,
  501. X+      *    this can move to common.
  502. X+      */
  503. X+ int    SYSVCurrentX = 0;
  504. X+ int    SYSVCurrentY = 0;
  505. X+ /***====================================================================***/
  506. X+ static void
  507. X+ SYSVFlushMouse()
  508. X+ {
  509. X+ register    int    x,y;
  510. X+ register    ibmPerScreenInfo    *screenInfo;
  511. X+         int    oldScr;
  512. X+         int    setCursor;
  513. X+         xEvent    e;
  514. X+     TRACE(("SYSVFlushMouse\n"));
  515. X+     if ((pendingX)||(pendingY)) {
  516. X+     ibmAccelerate(pendingX,pendingY);
  517. X+     x= SYSVCurrentX+pendingX;
  518. X+     y= SYSVCurrentY-pendingY;
  519. X+     screenInfo = ibmScreens[ oldScr = ibmCurrentScreen ];
  520. X+     setCursor = FALSE;
  521. X+     if (ibmYWrapScreen) {
  522. X+         while ( y<0 ) {
  523. X+         y+=    screenInfo->ibm_ScreenBounds.y2;
  524. X+         setCursor= TRUE;
  525. X+         }
  526. X+         while ( y>screenInfo->ibm_ScreenBounds.y2 ) {
  527. X+         y-=    screenInfo->ibm_ScreenBounds.y2;
  528. X+         setCursor= TRUE;
  529. X+         }
  530. X+     }
  531. X+     while ( x<0 ) {
  532. X+         if ( screenInfo == ibmScreens[ 0 ] ) {
  533. X+         /* Already at first possible screen */
  534. X+         if ( ibmXWrapScreen ) {
  535. X+             screenInfo =
  536. X+             ibmScreens[ ibmCurrentScreen = ibmNumScreens -1 ];
  537. X+             x+= screenInfo->ibm_ScreenBounds.x2;
  538. X+         }
  539. X+         else {
  540. X+             x= 0;
  541. X+         }
  542. X+         }
  543. X+         else {
  544. X+         screenInfo= ibmScreens[ --ibmCurrentScreen ];
  545. X+         x+= screenInfo->ibm_ScreenBounds.x2;
  546. X+         }
  547. X+         setCursor= TRUE;
  548. X+     }
  549. X+     while ( x>screenInfo->ibm_ScreenBounds.x2 ) {
  550. X+         if ( screenInfo == ibmScreens[ ibmNumScreens - 1 ] ) {
  551. X+         /* Already at last possible screen */
  552. X+         if ( ibmXWrapScreen ) {
  553. X+             x-= screenInfo->ibm_ScreenBounds.x2;
  554. X+             screenInfo= ibmScreens[ ibmCurrentScreen = 0 ];
  555. X+         }
  556. X+         else {
  557. X+             x= screenInfo->ibm_ScreenBounds.x2;
  558. X+         }
  559. X+         }
  560. X+         else {
  561. X+         x-=  screenInfo->ibm_ScreenBounds.x2;    /* now x>0 */
  562. X+         screenInfo= ibmScreens[ ++ibmCurrentScreen ];
  563. X+         }
  564. X+         setCursor= TRUE;
  565. X+     }
  566. X+     if (y>screenInfo->ibm_ScreenBounds.y2) {
  567. X+         y= screenInfo->ibm_ScreenBounds.y2;
  568. X+         setCursor= TRUE;
  569. X+     }
  570. X+     if (y<0) {
  571. X+         y= 0;
  572. X+         setCursor= TRUE;
  573. X+     }
  574. X+     if (setCursor) {
  575. X+         /* OS-DEPENDENT MACRO GOES HERE!!
  576. X+          * MACRO DEFINED IN FILE ibmos.h
  577. X+          * TELL OS THAT CURSOR HAS MOVED
  578. X+          * TO A NEW POSITION
  579. X+          */
  580. X+         OS_TellCursorPosition(x,y);
  581. X+     }
  582. X+ #if defined(MULTIPLE_HEADS)
  583. X+     if ( oldScr != ibmCurrentScreen ) {
  584. X+         (*ibmHideCursor( oldScr ) )( oldScr ) ;
  585. X+         NewCurrentScreen( screenInfo->ibm_Screen, x, y ) ;
  586. X+         if ( screenInfo->ibm_CurrentCursor != ibmCurrentCursor( oldScr ) ) {
  587. X+         (* screenInfo->ibm_Screen->RealizeCursor )(
  588. X+             screenInfo->ibm_Screen,
  589. X+             ibmCurrentCursor( oldScr ) ) ;
  590. X+         }
  591. X+         (* screenInfo->ibm_Screen->DisplayCursor )(
  592. X+             screenInfo->ibm_Screen,
  593. X+             ibmCurrentCursor( oldScr ) ) ;
  594. X+     }
  595. X+ #endif /* MULTIPLE HEADS */
  596. X+     (* screenInfo->ibm_CursorShow )( x, y ) ;
  597. X+     e.u.u.type=             MotionNotify;
  598. X+     e.u.keyButtonPointer.rootX=    SYSVCurrentX= x;
  599. X+     e.u.keyButtonPointer.rootY=    SYSVCurrentY= y;
  600. X+     e.u.keyButtonPointer.time=    lastEventTime = GET_OS_TIME();
  601. X+     pendingX= pendingY= 0;
  602. X+     (*ibmPtr->processInputProc)(&e,ibmPtr,1);
  603. X+     }
  604. X+ }
  605. X+ /***====================================================================***/
  606. X+     /*
  607. X+      * All of this keyboard stuff needs to
  608. X+      * be reorganized anyway (into osKeymap.h and a single keyboard.c)
  609. X+      */
  610. X+ /***====================================================================***/
  611. X+ static int
  612. X+ SYSVKbdEvents()
  613. X+ {
  614. X+   DeviceIntPtr            KeyboardPtr;
  615. X+   xEvent        e;
  616. X+   int                   key,keymodifier,i,nBytes;
  617. X+   unsigned char         rBuf[64];
  618. X+   Bool                  rpt;
  619. X+   static int            lastkey = 0;
  620. X+   static int        doomsday = 0;
  621. X+ 
  622. X+   if ((nBytes=read(SYSVconsoleFd,rBuf,64)) == 0) return 0;
  623. X+   for (i=0; i<nBytes; i++) {
  624. X+     key = ( rBuf[i] & 0x7f) + SYSV_MIN_KEY ;
  625. X+     TRACE(("SYSVKbdEvent (%d)\n",key));
  626. X+     if ((pendingX)||(pendingY))
  627. X+     SYSVFlushMouse();
  628. X+     e.u.keyButtonPointer.rootX=    SYSVCurrentX;
  629. X+     e.u.keyButtonPointer.rootY=    SYSVCurrentY;
  630. X+     e.u.keyButtonPointer.time=    lastEventTime= GET_OS_TIME();
  631. X+     e.u.u.detail= key ;
  632. X+     rpt = (rBuf[i] == lastkey);
  633. X+     lastkey = rBuf[i];
  634. X+     KeyboardPtr = (DeviceIntPtr)ibmKeybd;
  635. X+     keymodifier = KeyboardPtr->key->modifierMap[key];
  636. X+     if (((!ibmKeyRepeat) || ( keymodifier != 0)) && rpt)
  637. X+       continue;
  638. X+     if (rpt) {
  639. X+       e.u.u.type= KeyRelease;
  640. X+       (*ibmKeybd->processInputProc)(&e,ibmKeybd,1);
  641. X+       e.u.u.type= KeyPress;
  642. X+     }
  643. X+     else if (rBuf[i] & 0x80)    e.u.u.type= KeyRelease;
  644. X+     else            e.u.u.type= KeyPress;
  645. X+     /*
  646. X+      * Handle Ctrl & Alt & Del as ServerShutdown !
  647. X+      */
  648. X+     switch (key) {
  649. X+         case Sysv_Delete:
  650. X+         doomsday = (doomsday | 0x4) ^ ((rBuf[i] & 0x80)>>5);
  651. X+         break;
  652. X+         case Sysv_Alt_L:
  653. X+         doomsday = (doomsday | 0x2) ^ ((rBuf[i] & 0x80)>>6);
  654. X+         break;
  655. X+         case Sysv_Control_L:
  656. X+         doomsday = (doomsday | 0x1) ^ ((rBuf[i] & 0x80)>>7);
  657. X+         break;
  658. X+     }
  659. X+     if ((!ibmDontZap) && (doomsday == 7)) GiveUp();
  660. X+     /*
  661. X+      *    toggle lock & numlock shift keys:
  662. X+      *    ignore releases, toggle on & off on presses
  663. X+      */
  664. X+     if( keymodifier & ( LockMask | NumLockMask))
  665. X+       {
  666. X+     if( e.u.u.type == KeyRelease )
  667. X+       break;
  668. X+     if( KeyboardPtr->key->down[key >> 3] & (1 << (key & 7)) )
  669. X+       {
  670. X+         e.u.u.type = KeyRelease;
  671. X+       }
  672. X+       }
  673. X+     (*ibmKeybd->processInputProc)(&e,ibmKeybd,1);
  674. X+   }
  675. X+   return(nBytes);
  676. X+ }
  677. X+ /***====================================================================***/
  678. X+ #define NONE    0x00
  679. X+ #define LEFT    Button1
  680. X+ #define MIDDLE  Button2
  681. X+ #define RIGHT   Button3
  682. X+ #define UP      ButtonRelease
  683. X+ #define DOWN    ButtonPress
  684. X+     /*
  685. X+      * 11/17/88 (ef) -- XXX!  This function should be revisited.  It
  686. X+      *    seems awfully large and complicated.  Two options leap to
  687. X+      *    to the fore:  a) just delay for a bit and check for new
  688. X+      *    events or go to a finite-state machine.
  689. X+      */
  690. X+ int
  691. X+ MSPtrEvent(pMouse)
  692. X+      DevicePtr pMouse;
  693. X+ {
  694. X+   extern int      SYSVMouseChordDelay;
  695. X+   static int      buttons;
  696. X+   static int      DeltaX,DeltaY;
  697. X+   int             i,nBytes;
  698. X+   unsigned char   rBuf[64];
  699. X+   int             changed;
  700. X+   xEvent          e;
  701. X+   nBytes = read(SYSVmouseFd,&rBuf,64);
  702. X+   for ( i=0; i <=nBytes; i++) {
  703. X+     if (i != nBytes) {
  704. X+       switch(SYSVMouseState) {
  705. X+       case 0:
  706. X+     if ((rBuf[i] & 0x40) == 0x40) {
  707. X+       buttons= rBuf[i] & 0x30;
  708. X+       DeltaY = (signed char)((rBuf[i] &0xC) <<4);
  709. X+       DeltaX = (signed char)((rBuf[i] &0x3) <<6);
  710. X+       SYSVMouseState++; }
  711. X+     break;
  712. X+       case 1:
  713. X+     DeltaX |= (signed char)(rBuf[i]&0x3F);
  714. X+     SYSVMouseState++;
  715. X+     break;
  716. X+       case 2:
  717. X+     DeltaY |= (signed char)(rBuf[i]&0x3F);
  718. X+     SYSVMouseState = 0;
  719. X+     break;
  720. X+       }
  721. X+     }
  722. X+     if (SYSVMouseState == 0) {
  723. X+       TRACE(("SYSVPtrEvent (%d,%d)\n", DeltaX, DeltaY));
  724. X+       pendingX+= DeltaX;
  725. X+       pendingY-= DeltaY;
  726. X+       if (pendingX||pendingY)
  727. X+     SYSVFlushMouse();
  728. X+       DeltaX = DeltaY = 0;
  729. X+       e.u.keyButtonPointer.rootX=     SYSVCurrentX;
  730. X+       e.u.keyButtonPointer.rootY=     SYSVCurrentY;
  731. X+       e.u.keyButtonPointer.time=      GET_OS_TIME();
  732. X+       if ((i != nBytes) || ((e.u.keyButtonPointer.time - lastEventTime) > 225))
  733. X+     {
  734. X+       switch(lastButtons)
  735. X+         {
  736. X+         case NONE  :
  737. X+           switch(buttons)
  738. X+         {
  739. X+         case NONE  :
  740. X+           break;
  741. X+         case MS_LBUTTON  :
  742. X+           delayed_left = TRUE;
  743. X+           break;
  744. X+         case MS_RBUTTON  :
  745. X+           delayed_right = TRUE;
  746. X+           break;
  747. X+         case MS_BUTTONS  :
  748. X+           e.u.u.detail= MIDDLE;
  749. X+           e.u.u.type=   DOWN;
  750. X+           (*ibmPtr->processInputProc)(&e,ibmPtr,1);
  751. X+           break;
  752. X+         }
  753. X+           break;
  754. X+         case MS_LBUTTON  :
  755. X+           switch(buttons)
  756. X+         {
  757. X+         case NONE  :
  758. X+           if (delayed_left) {
  759. X+             e.u.u.detail= LEFT;
  760. X+             e.u.u.type=   DOWN;
  761. X+             (*ibmPtr->processInputProc)(&e,ibmPtr,1);
  762. X+             delayed_left = FALSE;
  763. X+           }
  764. X+           if (delayed_middle) {
  765. X+             e.u.u.detail= MIDDLE;
  766. X+             e.u.u.type=   UP;
  767. X+             (*ibmPtr->processInputProc)(&e,ibmPtr,1);
  768. X+             delayed_middle = FALSE;
  769. X+           } else {
  770. X+             e.u.u.detail= LEFT;
  771. X+             e.u.u.type=   UP;
  772. X+             (*ibmPtr->processInputProc)(&e,ibmPtr,1);
  773. X+           }
  774. X+           break;
  775. X+         case MS_LBUTTON  :
  776. X+           if (delayed_left) {
  777. X+             e.u.u.detail= LEFT;
  778. X+             e.u.u.type=   DOWN;
  779. X+             (*ibmPtr->processInputProc)(&e,ibmPtr,1);
  780. X+             delayed_left = FALSE;
  781. X+           }
  782. X+           break;
  783. X+         case MS_RBUTTON  :
  784. X+           if (delayed_left) {
  785. X+             e.u.u.detail= LEFT;
  786. X+             e.u.u.type=   DOWN;
  787. X+             (*ibmPtr->processInputProc)(&e,ibmPtr,1);
  788. X+             delayed_left = FALSE;
  789. X+           }
  790. X+           e.u.u.detail= LEFT;
  791. X+           e.u.u.type=   UP;
  792. X+           (*ibmPtr->processInputProc)(&e,ibmPtr,1);
  793. X+           delayed_right = TRUE;
  794. X+           break;
  795. X+         case MS_BUTTONS  :
  796. X+           if (delayed_left) {
  797. X+             e.u.u.detail= MIDDLE;
  798. X+             e.u.u.type=   DOWN;
  799. X+             (*ibmPtr->processInputProc)(&e,ibmPtr,1);
  800. X+             delayed_left = FALSE;
  801. X+           } else if (!delayed_middle) {
  802. X+             e.u.u.detail= LEFT;
  803. X+             e.u.u.type=   UP;
  804. X+             (*ibmPtr->processInputProc)(&e,ibmPtr,1);
  805. X+             e.u.u.detail= MIDDLE;
  806. X+             e.u.u.type=   DOWN;
  807. X+             (*ibmPtr->processInputProc)(&e,ibmPtr,1);
  808. X+           }
  809. X+           break;
  810. X+         }
  811. X+           break;
  812. X+         case MS_RBUTTON  :
  813. X+           switch(buttons)
  814. X+         {
  815. X+         case NONE  :
  816. X+           if (delayed_right) {
  817. X+             e.u.u.detail= RIGHT;
  818. X+             e.u.u.type=   DOWN;
  819. X+             (*ibmPtr->processInputProc)(&e,ibmPtr,1);
  820. X+             delayed_right = FALSE;
  821. X+           }
  822. X+           if (delayed_middle) {
  823. X+             e.u.u.detail= MIDDLE;
  824. X+             e.u.u.type=   UP;
  825. X+             (*ibmPtr->processInputProc)(&e,ibmPtr,1);
  826. X+             delayed_middle = FALSE;
  827. X+           } else {
  828. X+             e.u.u.detail= RIGHT;
  829. X+             e.u.u.type=   UP;
  830. X+             (*ibmPtr->processInputProc)(&e,ibmPtr,1);
  831. X+           }
  832. X+           break;
  833. X+         case MS_LBUTTON  :
  834. X+           if (delayed_right) {
  835. X+             e.u.u.detail= RIGHT;
  836. X+             e.u.u.type=   DOWN;
  837. X+             (*ibmPtr->processInputProc)(&e,ibmPtr,1);
  838. X+             delayed_right = FALSE;
  839. X+           }
  840. X+           e.u.u.detail= RIGHT;
  841. X+           e.u.u.type=   UP;
  842. X+           (*ibmPtr->processInputProc)(&e,ibmPtr,1);
  843. X+           delayed_left = TRUE;
  844. X+           break;
  845. X+         case MS_RBUTTON  :
  846. X+           if (delayed_right) {
  847. X+             e.u.u.detail= RIGHT;
  848. X+             e.u.u.type=   DOWN;
  849. X+             (*ibmPtr->processInputProc)(&e,ibmPtr,1);
  850. X+             delayed_right = FALSE;
  851. X+           }
  852. X+           break;
  853. X+         case MS_BUTTONS  :
  854. X+           if (delayed_right) {
  855. X+             e.u.u.detail= MIDDLE;
  856. X+             e.u.u.type=   DOWN;
  857. X+             (*ibmPtr->processInputProc)(&e,ibmPtr,1);
  858. X+             delayed_right = FALSE;
  859. X+           } else if (!delayed_middle) {
  860. X+             e.u.u.detail= RIGHT;
  861. X+             e.u.u.type=   UP;
  862. X+             (*ibmPtr->processInputProc)(&e,ibmPtr,1);
  863. X+             e.u.u.detail= MIDDLE;
  864. X+             e.u.u.type=   DOWN;
  865. X+             (*ibmPtr->processInputProc)(&e,ibmPtr,1);
  866. X+           }
  867. X+           break;
  868. X+         }
  869. X+           break;
  870. X+         case MS_BUTTONS  :
  871. X+           switch(buttons)
  872. X+         {
  873. X+         case NONE  :
  874. X+           e.u.u.detail= MIDDLE;
  875. X+           e.u.u.type=   UP;
  876. X+           (*ibmPtr->processInputProc)(&e,ibmPtr,1);
  877. X+           break;
  878. X+         case MS_LBUTTON  :
  879. X+         case MS_RBUTTON  :
  880. X+           delayed_middle = TRUE;
  881. X+           break;
  882. X+         case MS_BUTTONS  :
  883. X+           break;
  884. X+         }
  885. X+           break;
  886. X+         }
  887. X+       lastButtons = buttons;
  888. X+     }
  889. X+     }
  890. X+   }
  891. X+   return(nBytes);
  892. X+ }
  893. X+ /***====================================================================***/
  894. X+ int
  895. X+   MSMPtrEvent()
  896. X+ {
  897. X+   extern  int     SYSVMouseChordDelay;
  898. X+   static int      buttons;
  899. X+   static int      DeltaX,DeltaY;
  900. X+   xEvent          e;
  901. X+   int             i,nBytes;
  902. X+   unsigned char   rBuf[64];
  903. X+   int             changed;
  904. X+   if ((nBytes = read(SYSVmouseFd,&rBuf,64)) == 0) return(0);
  905. X+   for ( i=0; i < nBytes; i++) {
  906. X+     switch(SYSVMouseState) {
  907. X+     case 0:
  908. X+       if ((rBuf[i] & 0xF8) == 0x80) {
  909. X+     buttons = (~rBuf[i]) & 0x07;
  910. X+     SYSVMouseState++; }
  911. X+       break;
  912. X+     case 1:
  913. X+       DeltaX=(signed char)rBuf[i];
  914. X+       SYSVMouseState++;
  915. X+       break;
  916. X+     case 2:
  917. X+       DeltaY=(signed char)rBuf[i];
  918. X+       SYSVMouseState++;
  919. X+       break;
  920. X+     case 3:
  921. X+       DeltaX=(signed char)rBuf[i];
  922. X+       SYSVMouseState++;
  923. X+       break;
  924. X+     case 4:
  925. X+       DeltaY=(signed char)rBuf[i];
  926. X+       SYSVMouseState=0;
  927. X+       break;
  928. X+     }
  929. X+     if (SYSVMouseState == 0) {
  930. X+       TRACE(("MSM_PtrEvent (%d,%d)\n", DeltaX,DeltaY));
  931. X+       pendingX+= DeltaX;
  932. X+       pendingY+= DeltaY;
  933. X+       if (pendingX||pendingY)
  934. X+     SYSVFlushMouse();
  935. X+       e.u.keyButtonPointer.rootX=     SYSVCurrentX;
  936. X+       e.u.keyButtonPointer.rootY=     SYSVCurrentY;
  937. X+       e.u.keyButtonPointer.time=      GET_OS_TIME();
  938. X+       changed = buttons ^ lastButtons;
  939. X+       if (changed & MSM_LBUTTON) {
  940. X+     if (buttons & MSM_LBUTTON)      e.u.u.type = DOWN;
  941. X+     else                        e.u.u.type = UP;
  942. X+     e.u.u.detail= LEFT;
  943. X+     (*ibmPtr->processInputProc)(&e,ibmPtr,1);
  944. X+       }
  945. X+       if (changed & MSM_RBUTTON) {
  946. X+     if (buttons & MSM_RBUTTON)      e.u.u.type = DOWN;
  947. X+     else                        e.u.u.type = UP;
  948. X+     e.u.u.detail= RIGHT;
  949. X+     (*ibmPtr->processInputProc)(&e,ibmPtr,1);
  950. X+       }
  951. X+       if (changed & MSM_MBUTTON) {
  952. X+     if (buttons & MSM_MBUTTON)      e.u.u.type = DOWN;
  953. X+     else                        e.u.u.type = UP;
  954. X+     e.u.u.detail= MIDDLE;
  955. X+     (*ibmPtr->processInputProc)(&e,ibmPtr,1);
  956. X+       }
  957. X+       lastButtons = buttons;
  958. X+     }
  959. X+   }
  960. X+   return(nBytes);
  961. X+ }
  962. X+ /***====================================================================***/
  963. X+ void
  964. X+ ProcessInputEvents ()
  965. X+ {
  966. X+   TRACE(("ProcessInputEvents\n"));
  967. X+ #ifdef IBM_SPECIAL_MALLOC
  968. X+   if (ibmShouldDumpArena) {
  969. X+     ibmDumpArena();
  970. X+   }
  971. X+ #endif /* IBM_SPECIAL_MALLOC */
  972. X+   /*
  973. X+    * So long as one event from either device remains unprocess, we loop:
  974. X+    * Take the oldest remaining event and pass it to the proper module
  975. X+    * for processing. The DDXEvent will be sent to ProcessInput by the
  976. X+    * function called.
  977. X+    */
  978. X+   while (1) {
  979. X+     if (((* SYSVPtrEvents)() == 0) &&
  980. X+     (SYSVKbdEvents() == 0))
  981. X+       break;
  982. X+     lastEventTime = GetTimeInMillis();
  983. X+     if (screenIsSaved == SCREEN_SAVER_ON) {
  984. X+       SaveScreens(SCREEN_SAVER_OFF, ScreenSaverReset);
  985. X+     }
  986. X+   }
  987. X+   if (pendingX||pendingY)
  988. X+     SYSVFlushMouse();
  989. X+   return;
  990. X+ }
  991. X*** ./mit-orig/server/ddx/ibm/sysV/sysVInit.c    Thu Oct  4 18:02:21 1990
  992. X--- ./mit/server/ddx/ibm/sysV/sysVInit.c    Mon Sep 17 10:45:32 1990
  993. X***************
  994. X*** 0 ****
  995. X--- 1,91 ----
  996. X+ /*
  997. X+  * Copyright IBM Corporation 1987,1988,1989
  998. X+  *
  999. X+  * All Rights Reserved
  1000. X+  *
  1001. X+  * Permission to use, copy, modify, and distribute this software and its
  1002. X+  * documentation for any purpose and without fee is hereby granted,
  1003. X+  * provided that the above copyright notice appear in all copies and that
  1004. X+  * both that copyright notice and this permission notice appear in
  1005. X+  * supporting documentation, and that the name of IBM not be
  1006. X+  * used in advertising or publicity pertaining to distribution of the
  1007. X+  * software without specific, written prior permission.
  1008. X+  *
  1009. X+  * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  1010. X+  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  1011. X+  * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  1012. X+  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  1013. X+  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  1014. X+  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  1015. X+  * SOFTWARE.
  1016. X+  *
  1017. X+ */
  1018. X+ #include <sys/types.h>
  1019. X+ #include <sys/file.h>
  1020. X+ #include <sys/fcntl.h>
  1021. X+ #ifdef sco
  1022. X+ #include <sys/vtkd.h>
  1023. X+ #else
  1024. X+ #include <sys/vt.h>
  1025. X+ #endif
  1026. X+ #include <stdio.h>
  1027. X+ #include "Xmd.h"
  1028. X+ #include "miscstruct.h"
  1029. X+ #include "scrnintstr.h"
  1030. X+ #include "cursor.h"
  1031. X+ #include "ibmScreen.h"
  1032. X+ #include "OSio.h"
  1033. X+ #include "ibmTrace.h"
  1034. X+ /***====================================================================***/
  1035. X+ int    SYSVDefaultDisplay= 0;
  1036. X+ void
  1037. X+ SYSVMachineDependentInit()
  1038. X+ {
  1039. X+   int  tmp;
  1040. X+   long ttyno;
  1041. X+   char vtname[10];
  1042. X+   extern int errno;
  1043. X+   TRACE(("SYSVMachineDependentInit()\n"));
  1044. X+ #ifdef sco
  1045. X+   strcpy(vtname, ttyname(0));
  1046. X+   if (strcmp(vtname, "/dev/syscon"))
  1047. X+       SYSVconsoleNum = atoi( vtname [strlen(vtname)-2] ) - 1;
  1048. X+   else
  1049. X+       SYSVconsoleNum = 0;
  1050. X+ 
  1051. X+   /*
  1052. X+    * For SCO we will detach from the controlling terminal now
  1053. X+    * that we got a handle on the situation.
  1054. X+    */
  1055. X+ 
  1056. X+   close(0);
  1057. X+   close(1);
  1058. X+   setpgrp();
  1059. X+ 
  1060. X+   if ((SYSVconsoleFd = open(vtname, O_RDWR | O_NDELAY, 0)) < 0)
  1061. X+     ErrorF ("Opening the display (%s, %d)\n", vtname, errno);
  1062. X+ #else
  1063. X+   if ((tmp = open("/dev/console",O_RDONLY,0)) <0)
  1064. X+     ErrorF("Opening /dev/console\n");
  1065. X+   if (ioctl(tmp, VT_OPENQRY, &ttyno) <0)
  1066. X+     ErrorF("Finding free virtual terminal\n");
  1067. X+   close(tmp);
  1068. X+   sprintf(vtname,"/dev/vt0%1d",ttyno);
  1069. X+   if ((SYSVconsoleFd = open(vtname, O_RDWR | O_NDELAY, 0)) < 0)
  1070. X+     ErrorF ("Opening the display (%s, %d)\n", vtname, errno);
  1071. X+ #endif
  1072. X+ 
  1073. X+   TRACE(("Init: %d,%s\n",SYSVconsoleFd,vtname));
  1074. X+   return;
  1075. X+ }
  1076. X+ /***====================================================================***/
  1077. X+ char * SYSVresolution = "640x480";
  1078. X+ void
  1079. X+ SYSVGetDefaultScreens()
  1080. X+ {
  1081. X+   TRACE(("SYSVGetDefaultScreens()\n"));
  1082. X+   /*
  1083. X+    * add defaults Flag for resolution 640x480
  1084. X+    */
  1085. X+   return;
  1086. X+ }
  1087. X*** ./mit-orig/server/ddx/ibm/sysV/sysVKeybd.c    Thu Oct  4 18:02:21 1990
  1088. X--- ./mit/server/ddx/ibm/sysV/sysVKeybd.c    Fri Sep 28 11:25:36 1990
  1089. X***************
  1090. X*** 0 ****
  1091. X--- 1,206 ----
  1092. X+ /*
  1093. X+  * Copyright IBM Corporation 1987,1988,1989
  1094. X+  *
  1095. X+  * All Rights Reserved
  1096. X+  *
  1097. X+  * Permission to use, copy, modify, and distribute this software and its
  1098. X+  * documentation for any purpose and without fee is hereby granted,
  1099. X+  * provided that the above copyright notice appear in all copies and that
  1100. X+  * both that copyright notice and this permission notice appear in
  1101. X+  * supporting documentation, and that the name of IBM not be
  1102. X+  * used in advertising or publicity pertaining to distribution of the
  1103. X+  * software without specific, written prior permission.
  1104. X+  *
  1105. X+  * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  1106. X+  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  1107. X+  * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  1108. X+  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  1109. X+  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  1110. X+  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  1111. X+  * SOFTWARE.
  1112. X+  *
  1113. X+ */
  1114. X+ /***********************************************************
  1115. X+         Copyright IBM Corporation 1987,1988
  1116. X+                       All Rights Reserved
  1117. X+ Permission to use, copy, modify, and distribute this software and its
  1118. X+ documentation for any purpose and without fee is hereby granted,
  1119. X+ provided that the above copyright notice appear in all copies and that
  1120. X+ both that copyright notice and this permission notice appear in
  1121. X+ supporting documentation, and that the name of IBM not be
  1122. X+ used in advertising or publicity pertaining to distribution of the
  1123. X+ software without specific, written prior permission.
  1124. X+ IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  1125. X+ ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  1126. X+ IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  1127. X+ ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  1128. X+ WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  1129. X+ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  1130. X+ SOFTWARE.
  1131. X+ ******************************************************************/
  1132. X+ #include <stdio.h>
  1133. X+ #include <sys/types.h>
  1134. X+ #include <sys/file.h>
  1135. X+ #include <sys/fcntl.h>
  1136. X+ #include <sys/termio.h>
  1137. X+ #ifdef sco
  1138. X+ #include <sys/vtkd.h>
  1139. X+ #else
  1140. X+ #include <sys/at_ansi.h>
  1141. X+ #include <sys/kd.h>
  1142. X+ #include <sys/vt.h>
  1143. X+ #endif
  1144. X+ #include "X.h"
  1145. X+ #include "Xmd.h"
  1146. X+ #include "input.h"
  1147. X+ #include "miscstruct.h"
  1148. X+ #include "scrnintstr.h"
  1149. X+ #include "keysym.h"
  1150. X+ #include "cursorstr.h"
  1151. X+ #include "sysVModKeys.h"
  1152. X+ #include "sysVKeymap.h"
  1153. X+ #include "ibmIO.h"
  1154. X+ #include "ibmKeybd.h"
  1155. X+ #include "ibmScreen.h"
  1156. X+ #include "ibmTrace.h"
  1157. X+ #include "OSio.h"
  1158. X+ /***============================================================***/
  1159. X+ static void
  1160. X+ SYSVChangeKeyboardControl(pDevice,ctrl)
  1161. X+     DevicePtr pDevice;
  1162. X+     KeybdCtrl *ctrl;
  1163. X+ {
  1164. X+     int volume;
  1165. X+     TRACE(("SYSVChangeKeyboardControl(pDev=0x%x,ctrl=0x%x)\n",pDevice,ctrl));
  1166. X+     ibmKeyClick =   ctrl->click;
  1167. X+     /* X specifies duration in milliseconds, RT in 1/128th's of a second */
  1168. X+     ibmBellPitch=    ctrl->bell_pitch;
  1169. X+     ibmBellDuration=     ((double)ctrl->bell_duration)*(128.0/1000.0);
  1170. X+     ibmKeyRepeat= ctrl->autoRepeat;
  1171. X+     ioctl(SYSVconsoleFd, KDSETLED, (ibmLEDState=ctrl->leds));
  1172. X+     return;
  1173. X+ }
  1174. X+ /***============================================================***/
  1175. X+ 
  1176. X+ static void
  1177. X+ SYSVBell(loud, pDevice)
  1178. X+     int loud;
  1179. X+     DevicePtr pDevice;
  1180. X+ {
  1181. X+     TRACE(("SYSVBell(loud= %d, pDev= 0x%x)\n",loud,pDevice));
  1182. X+ 
  1183. X+ #ifdef sco
  1184. X+     ioctl(SYSVconsoleFd, KIOCSOUND, ibmBellPitch << 2);
  1185. X+     nap(ibmBellDuration << 4);
  1186. X+     ioctl(SYSVconsoleFd, KIOCSOUND, 0);
  1187. X+ #else
  1188. X+     ioctl(SYSVconsoleFd, KDMKTONE, (ibmBellDuration << 16) | ibmBellPitch);
  1189. X+ #endif
  1190. X+     return;
  1191. X+ }
  1192. X+ /***============================================================***/
  1193. X+ Bool
  1194. X+ LegalModifier (key)
  1195. X+ BYTE    key;
  1196. X+ {
  1197. X+     TRACE(("LegalModifier(key= 0x%x)\n",key));
  1198. X+     if ((key==Sysv_Control_L) || (key==Sysv_Shift_L) || (key==Sysv_Shift_R) ||
  1199. X+     (key==Sysv_Caps_Lock) || (key==Sysv_Alt_L) || (key==Sysv_Alt_R) ||
  1200. X+     (key==Sysv_Control_R))
  1201. X+       return TRUE ;
  1202. X+     else
  1203. X+       return FALSE;
  1204. X+ }
  1205. X+ /***============================================================***/
  1206. X+ extern int ibmUsePCKeys;
  1207. X+ int kbdType ;
  1208. X+ SYSVGetKbdMappings(pKeySyms, pModMap)
  1209. X+ KeySymsPtr pKeySyms;
  1210. X+ CARD8 *pModMap;
  1211. X+ {
  1212. X+     register int i;
  1213. X+     TRACE(("SYSVGetKbdMappings( pKeySyms= 0x%x, pModMap= 0x%x )\n",
  1214. X+                             pKeySyms,pModMap));
  1215. X+     for (i = 0; i < MAP_LENGTH; i++)
  1216. X+        pModMap[i] = NoSymbol;
  1217. X+     if (ibmUsePCKeys) {
  1218. X+     pModMap[ Sysv_Control_L ] = LockMask;
  1219. X+     pModMap[ Sysv_Caps_Lock ] = ControlMask;
  1220. X+     }
  1221. X+     else {
  1222. X+     pModMap[ Sysv_Caps_Lock ] = LockMask;
  1223. X+     pModMap[ Sysv_Control_L ] = ControlMask;
  1224. X+     }
  1225. X+     pModMap[ Sysv_Control_R ] =    ControlMask;
  1226. X+     pModMap[ Sysv_Shift_L ] =    ShiftMask;
  1227. X+     pModMap[ Sysv_Shift_R ] =    ShiftMask;
  1228. X+     pModMap[ Sysv_Num_Lock ] =    NumLockMask;
  1229. X+     pModMap[ Sysv_Alt_L ] = Mod1Mask;
  1230. X+     pModMap[ Sysv_Alt_R ] = Mod1Mask;
  1231. X+     pKeySyms->minKeyCode=       SYSV_MIN_KEY;
  1232. X+     pKeySyms->maxKeyCode=       SYSV_MAX_KEY;
  1233. X+     pKeySyms->mapWidth=         SYSV_GLYPHS_PER_KEY;
  1234. X+     pKeySyms->map=              sysvmap;
  1235. X+   }
  1236. X+ /***============================================================***/
  1237. X+ int
  1238. X+ SYSVKeybdProc(pDev, onoff, argc, argv)
  1239. X+     DevicePtr      pDev;
  1240. X+     int      onoff;
  1241. X+     int         argc;
  1242. X+     char    *argv[];
  1243. X+ {
  1244. X+   KeySymsRec        keySyms;
  1245. X+   CARD8         modMap[MAP_LENGTH];
  1246. X+   struct termio         tty;
  1247. X+   static int            SYSVKbdTrans;
  1248. X+   static struct termio  SYSVKbdTTY;
  1249. X+   TRACE(("SYSVKeybdProc( pDev= 0x%x, onoff= 0x%x )\n",pDev,onoff));
  1250. X+   switch (onoff)
  1251. X+     {
  1252. X+     case DEVICE_INIT:
  1253. X+       ioctl (SYSVconsoleFd, KDGKBMODE, &SYSVKbdTrans);
  1254. X+       ioctl (SYSVconsoleFd, TCGETA, &SYSVKbdTTY);
  1255. X+       pDev->on = FALSE;
  1256. X+       ibmKeybd = pDev;
  1257. X+       SYSVGetKbdMappings( &keySyms, modMap );
  1258. X+       InitKeyboardDeviceStruct(
  1259. X+                    ibmKeybd, &keySyms, modMap, SYSVBell,
  1260. X+                    SYSVChangeKeyboardControl);
  1261. X+       break;
  1262. X+     case DEVICE_ON:
  1263. X+       /*
  1264. X+        * Set the keyboard into "direct" mode and turn on
  1265. X+        * event translation.
  1266. X+        */
  1267. X+       ioctl (SYSVconsoleFd, KDSKBMODE, K_RAW);
  1268. X+       tty = SYSVKbdTTY;
  1269. X+       tty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
  1270. X+       tty.c_oflag = 0;
  1271. X+       tty.c_cflag = CREAD | CS8 | B9600;
  1272. X+       tty.c_lflag = 0;
  1273. X+       tty.c_cc[VINTR]=0;
  1274. X+       tty.c_cc[VQUIT]=0;
  1275. X+       tty.c_cc[VERASE]=0;
  1276. X+       tty.c_cc[VKILL]=0;
  1277. X+       tty.c_cc[VEOF]=0;
  1278. X+       tty.c_cc[VEOL]=0;
  1279. X+       tty.c_cc[VTIME]=0;
  1280. X+       tty.c_cc[VMIN]=1;
  1281. X+       ioctl (SYSVconsoleFd, TCSETA, &tty);
  1282. X+       AddEnabledDevice(SYSVconsoleFd);
  1283. X+       pDev->on = TRUE;
  1284. X+       break;
  1285. X+     case DEVICE_CLOSE:
  1286. X+     case DEVICE_OFF:
  1287. X+       /*
  1288. X+        * Restore original keyboard directness and translation.
  1289. X+        */
  1290. X+       ioctl (SYSVconsoleFd, TCSETA, &SYSVKbdTTY);
  1291. X+       ioctl (SYSVconsoleFd, KDSKBMODE, SYSVKbdTrans);
  1292. X+       RemoveEnabledDevice(SYSVconsoleFd);
  1293. X+       pDev->on = FALSE;
  1294. X+       break;
  1295. X+     }
  1296. X+     return (Success);
  1297. X+ }
  1298. END_OF_FILE
  1299. if test 42622 -ne `wc -c <'fix-14.sco08'`; then
  1300.     echo shar: \"'fix-14.sco08'\" unpacked with wrong size!
  1301. fi
  1302. # end of 'fix-14.sco08'
  1303. fi
  1304. echo shar: End of archive 8 \(of 12\).
  1305. cp /dev/null ark8isdone
  1306. MISSING=""
  1307. for I in 1 2 3 4 5 6 7 8 9 10 11 12 ; do
  1308.     if test ! -f ark${I}isdone ; then
  1309.     MISSING="${MISSING} ${I}"
  1310.     fi
  1311. done
  1312. if test "${MISSING}" = "" ; then
  1313.     echo You have unpacked all 12 archives.
  1314.     echo "instructions are in fix-14.sco01"
  1315.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1316. else
  1317.     echo You still need to unpack the following archives:
  1318.     echo "        " ${MISSING}
  1319. fi
  1320. ##  End of shell archive.
  1321. exit 0
  1322.  
  1323.  
  1324. dan
  1325. ----------------------------------------------------
  1326. O'Reilly && Associates   argv@sun.com / argv@ora.com
  1327. Opinions expressed reflect those of the author only.
  1328.